package com.shujia.java.day7;

public class DemoString {
    public static void main(String[] args) {
        //统计有个字符出现的次数
        String str="czmbvafsgdfasdasdqweqeweq";
        //转为数组
        //定义1个数组
        String[] list=new String[str.length()];
        // 循环截取 赋值给数组
        for (int i = 0; i <=str.length()-1; i++) {
            list[i]=str.substring(i,i+1);
        }
        int sum=0;
        //
        for (String s: list) {
            if(s.equals("a")){
                sum++;
            }
        }
        System.out.println(sum);
    }
}
